home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / etc / bash_completion.d / _subversion next >
Text File  |  2009-04-02  |  10KB  |  427 lines

  1. # -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
  2. # ex: ts=8 sw=8 noet filetype=sh
  3. #
  4. # svn completion
  5. #
  6. have svn &&
  7. {
  8. _svn()
  9. {
  10.     local cur prev commands options command
  11.  
  12.     COMPREPLY=()
  13.     cur=`_get_cword`
  14.  
  15.     commands='add blame praise annotate ann cat checkout co cleanup commit \
  16.         ci copy cp delete del remove rm diff di export help ? h import \
  17.         info list ls lock log merge mkdir move mv rename ren \
  18.         propdel pdel pd propedit pedit pe propget pget pg \
  19.         proplist plist pl propset pset ps resolved revert \
  20.         status stat st switch sw unlock update up'
  21.  
  22.     if [[ $COMP_CWORD -eq 1 ]] ; then
  23.         if [[ "$cur" == -* ]]; then
  24.             COMPREPLY=( $( compgen -W '--version' -- $cur ) )
  25.         else
  26.             COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
  27.         fi
  28.     else
  29.  
  30.         prev=${COMP_WORDS[COMP_CWORD-1]}
  31.         case $prev in
  32.             --config-dir)
  33.                 _filedir -d
  34.                 return 0;
  35.                 ;;
  36.             -@(F|-file|-targets))
  37.                 _filedir
  38.                 return 0;
  39.                 ;;
  40.             --encoding)
  41.                 COMPREPLY=( $( compgen -W \
  42.                     '$( iconv --list | sed -e "s@//@@;" )' \
  43.                     -- "$cur" ) )
  44.                 return 0;
  45.                 ;;
  46.             --@(editor|diff|diff3)-cmd)
  47.                 COMP_WORDS=(COMP_WORDS[0] $cur)
  48.                 COMP_CWORD=1
  49.                 _command
  50.                 return 0;
  51.                 ;;
  52.         esac
  53.  
  54.         command=${COMP_WORDS[1]}
  55.  
  56.         if [[ "$cur" == -* ]]; then
  57.             # possible options for the command
  58.             case $command in
  59.                 add)
  60.                     options='--auto-props --no-auto-props \
  61.                         --force --targets --no-ignore \
  62.                         --non-recursive -N -q --quiet'
  63.                     ;;
  64.                 @(blame|annotate|ann|praise))
  65.                     options='-r --revisions --username \
  66.                         --password --no-auth-cache \
  67.                         --non-interactive -v \
  68.                         --verbose --incremental --xml'
  69.                     ;;
  70.                 cat)
  71.                     options='-r --revision --username \
  72.                         --password --no-auth-cache \
  73.                         --non-interactive'
  74.                     ;;
  75.                 @(checkout|co))
  76.                     options='-r --revision -q --quiet -N \
  77.                         --non-recursive --username \
  78.                         --password --no-auth-cache \
  79.                         --non-interactive \
  80.                         --ignore-externals'
  81.                     ;;
  82.                 cleanup)
  83.                     options='--diff3-cmd'
  84.                     ;;
  85.                 @(commit|ci))
  86.                     options='-m --message -F --file \
  87.                         --encoding --force-log -q \
  88.                         --quiet --non-recursive -N \
  89.                         --targets --editor-cmd \
  90.                         --username --password \
  91.                         --no-auth-cache \
  92.                         --non-interactive --no-unlock'
  93.                     ;;
  94.                 @(copy|cp))
  95.                     options='-m --message -F --file \
  96.                         --encoding --force-log -r \
  97.                         --revision -q --quiet \
  98.                         --editor-cmd -username \
  99.                         --password --no-auth-cache \
  100.                         --non-interactive'
  101.                     ;;
  102.                 @(delete|del|remove|rm))
  103.                     options='--force -m --message -F \
  104.                         --file --encoding --force-log \
  105.                         -q --quiet --targets \
  106.                         --editor-cmd -username \
  107.                         --password --no-auth-cache \
  108.                         --non-interactive'
  109.                     ;;
  110.                 @(diff|di))
  111.                     options='-r --revision -x --extensions \
  112.                         --diff-cmd --no-diff-deleted \
  113.                         -N --non-recursive --username \
  114.                         --password --no-auth-cache \
  115.                         --non-interactive --force \
  116.                         --old --new --notice-ancestry'
  117.                     ;;
  118.                 export)
  119.                     options='-r --revision -q --quiet \
  120.                         --username --password \
  121.                         --no-auth-cache \
  122.                         --non-interactive -N \
  123.                         --non-recursive --force \
  124.                         --native-eol --ignore-externals'
  125.                     ;;
  126.                 import)
  127.                     options='--auto-props --no-auto-props \
  128.                         -m --message -F --file \
  129.                         --encoding --force-log -q \
  130.                         --quiet --non-recursive \
  131.                         --no-ignore --editor-cmd \
  132.                         --username --password \
  133.                         --no-auth-cache \
  134.                         --non-interactive'
  135.                     ;;
  136.                 info)
  137.                     options='--username --password \
  138.                         --no-auth-cache \
  139.                         --non-interactive -r \
  140.                         --revision --xml --targets \
  141.                         -R --recursive --incremental'
  142.                     ;;
  143.                 @(list|ls))
  144.                     options='-r --revision -v --verbose -R \
  145.                         --recursive --username \
  146.                         --password --no-auth-cache \
  147.                         --non-interactive \
  148.                         --incremental --xml'
  149.                     ;;
  150.                 lock)
  151.                     options='-m --message -F --file \
  152.                         --encoding --force-log \
  153.                         --targets --force --username \
  154.                         --password --no-auth-cache \
  155.                         --non-interactive'
  156.                     ;;
  157.                 log)
  158.                     options='-r --revision -v --verbose \
  159.                         --targets --username \
  160.                         --password --no-auth-cache \
  161.                         --non-interactive \
  162.                         --stop-on-copy --incremental \
  163.                         --xml -q --quiet --limit'
  164.                     ;;
  165.                 merge)
  166.                     options='-r --revision -N \
  167.                         --non-recursive -q --quiet \
  168.                         --force --dry-run --diff3-cmd \
  169.                         --username --password \
  170.                         --no-auth-cache \
  171.                         --non-interactive \
  172.                         --ignore-ancestry'
  173.                     ;;
  174.                 mkdir)
  175.                     options='-m --message -F --file \
  176.                         --encoding --force-log -q \
  177.                         --quiet --editor-cmd \
  178.                         --username --password \
  179.                         --no-auth-cache \
  180.                         --non-interactive'
  181.                     ;;
  182.                 @(move|mv|rename|ren))
  183.                     options='-m --message -F --file \
  184.                         --encoding --force-log -r \
  185.                         --revision -q --quiet \
  186.                         --force --editor-cmd \
  187.                         --username --password \
  188.                         --no-auth-cache \
  189.                         --non-interactive'
  190.                     ;;
  191.                 @(propdel|pdel|pd))
  192.                     options='-q --quiet -R --recursive -r \
  193.                         --revision --revprop \
  194.                         --username --password \
  195.                         --no-auth-cache \
  196.                         --non-interactive'
  197.                     ;;
  198.                 @(propedit|pedit|pe))
  199.                     options='-r --revision --revprop \
  200.                         --encoding --editor-cmd \
  201.                         --username --password \
  202.                         --no-auth-cache \
  203.                         --non-interactive --force'
  204.                     ;;
  205.                 @(propget|pget|pg))
  206.                     options='-R --recursive -r --revision \
  207.                         --revprop --strict --username \
  208.                         --password --no-auth-cache \
  209.                         --non-interactive'
  210.                     ;;
  211.                 @(proplist|plist|pl))
  212.                     options='-v --verbose -R --recursive \
  213.                         -r --revision --revprop -q \
  214.                         --quiet --username --password \
  215.                         --no-auth-cache \
  216.                         --non-interactive'
  217.                     ;;
  218.                 @(propset|pset|ps))
  219.                     options='-F --file -q --quiet \
  220.                         --targets -R --recursive \
  221.                         --revprop --encoding \
  222.                         --username --password \
  223.                         --no-auth-cache \
  224.                         --non-interactive -r \
  225.                         --revision --force'
  226.                     ;;
  227.                 resolved)
  228.                     options='--targets -R --recursive -q \
  229.                         --quiet'
  230.                     ;;
  231.                 revert)
  232.                     options='--targets -R --recursive -q \
  233.                         --quiet'
  234.                     ;;
  235.                 @(status|stat|st))
  236.                     options='-u --show-updates -v \
  237.                         --verbose -N --non-recursive \
  238.                         -q --quiet --username \
  239.                         --password --no-auth-cache \
  240.                         --non-interactive --no-ignore \
  241.                         --ignore-externals \
  242.                         --incremental --xml'
  243.                     ;;
  244.                 @(switch|sw))
  245.                     options='--relocate -r --revision -N \
  246.                         --non-recursive -q --quiet \
  247.                         --username --password \
  248.                         --no-auth-cache \
  249.                         --non-interactive --diff3-cmd'
  250.                     ;;
  251.                 unlock)
  252.                     options='--targets --force --username \
  253.                         --password --no-auth-cache \
  254.                         --non-interactive'
  255.                     ;;
  256.                 @(update|up))
  257.                     options='-r --revision -N \
  258.                         --non-recursive -q --quiet \
  259.                         --username --password \
  260.                         --no-auth-cache \
  261.                         --non-interactive \
  262.                         --diff3-cmd --ignore-externals'
  263.                     ;;
  264.             esac
  265.             options="$options --help -h --config-dir"
  266.  
  267.             COMPREPLY=( $( compgen -W "$options" -- $cur ) )
  268.         else
  269.             if [[ "$command" == @(help|h|\?) ]]; then
  270.                 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
  271.             else
  272.                 _filedir
  273.             fi
  274.         fi
  275.     fi
  276.  
  277.     return 0
  278. }
  279. complete -F _svn $filenames svn
  280.  
  281. _svnadmin()
  282. {
  283.     local cur prev commands options mode
  284.  
  285.     COMPREPLY=()
  286.     cur=`_get_cword`
  287.  
  288.     commands='create deltify dump help ? hotcopy list-dblogs \
  289.         list-unused-dblogs load lslocks lstxns recover rmlocks \
  290.         rmtxns setlog verify'
  291.  
  292.     if [[ $COMP_CWORD -eq 1 ]] ; then
  293.         if [[ "$cur" == -* ]]; then
  294.             COMPREPLY=( $( compgen -W '--version' -- $cur ) )
  295.         else
  296.             COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
  297.         fi
  298.     else
  299.         prev=${COMP_WORDS[COMP_CWORD-1]}
  300.         case $prev in
  301.             --config-dir)
  302.                 _filedir -d
  303.                 return 0;
  304.                 ;;
  305.             --fs-type)
  306.                 COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
  307.                 return 0;
  308.                 ;;
  309.         esac
  310.  
  311.         command=${COMP_WORDS[1]}
  312.  
  313.         if [[ "$cur" == -* ]]; then
  314.             # possible options for the command
  315.             case $command in
  316.                 create)
  317.                     options='--bdb-txn-nosync \
  318.                         --bdb-log-keep --config-dir \
  319.                         --fs-type'
  320.                     ;;
  321.                 deltify)
  322.                     options='-r --revision -q --quiet'
  323.                     ;;
  324.                 dump)
  325.                     options='-r --revision --incremental \
  326.                         -q --quiet --deltas'
  327.                     ;;
  328.                 hotcopy)
  329.                     options='--clean-logs'
  330.                     ;;
  331.                 load)
  332.                     options='--ignore-uuid --force-uuid \
  333.                         --parent-dir -q --quiet \
  334.                         --use-pre-commit-hook \
  335.                         --use-post-commit-hook'
  336.                     ;;
  337.                 rmtxns)
  338.                     options='-q --quiet'
  339.                     ;;
  340.                 setlog)
  341.                     options='-r --revision --bypass-hooks'
  342.                     ;;
  343.             esac
  344.  
  345.             options="$options --help -h"
  346.             COMPREPLY=( $( compgen -W "$options" -- $cur ) )
  347.         else
  348.             if [[ "$command" == @(help|h|\?) ]]; then
  349.                 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
  350.             else
  351.                 _filedir
  352.             fi
  353.         fi
  354.     fi
  355.  
  356.     return 0
  357. }
  358. complete -F _svnadmin $default svnadmin
  359.  
  360. _svnlook()
  361. {
  362.     local cur prev commands options mode
  363.  
  364.     COMPREPLY=()
  365.     cur=`_get_cword`
  366.  
  367.     commands='author cat changed date diff dirs-changed help ? h history \
  368.         info lock log propget pget pg proplist plist pl tree uuid \
  369.         youngest'
  370.  
  371.     if [[ $COMP_CWORD -eq 1 ]] ; then
  372.         if [[ "$cur" == -* ]]; then
  373.             COMPREPLY=( $( compgen -W '--version' -- $cur ) )
  374.         else
  375.             COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
  376.         fi
  377.     else
  378.         command=${COMP_WORDS[1]}
  379.  
  380.         if [[ "$cur" == -* ]]; then
  381.             # possible options for the command
  382.             case $command in
  383.                 @(author|cat|date|dirs-changed|info|log))
  384.                     options='-r --revision -t \
  385.                         --transaction'
  386.                     ;;
  387.                 changed)
  388.                     options='-r --revision -t \
  389.                         --transaction --copy-info'
  390.                     ;;
  391.                 diff)
  392.                     options='-r --revision -t \
  393.                         --transaction \
  394.                         --no-diff-deleted \
  395.                         --no-diff-added \
  396.                         --diff-copy-from'
  397.                     ;;
  398.                 history)
  399.                     options='-r --revision --show-ids'
  400.                     ;;
  401.                 prop@(get|list))
  402.                     options='-r --revision -t \
  403.                         --transaction --revprop'
  404.                     ;;
  405.                 tree)
  406.                     options='-r --revision -t \
  407.                         --transaction --show-ids \
  408.                         --full-paths'
  409.                     ;;
  410.             esac
  411.  
  412.             options="$options --help -h"
  413.             COMPREPLY=( $( compgen -W "$options" -- $cur ) )
  414.         else
  415.             if [[ "$command" == @(help|h|\?) ]]; then
  416.                 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
  417.             else
  418.                 _filedir
  419.             fi
  420.         fi
  421.     fi
  422.  
  423.     return 0
  424. }
  425. complete -F _svnlook $default svnlook
  426. }
  427.